cmake_minimum_required(VERSION 3.19)
project(surgicalrobot LANGUAGES CXX)

find_package(Qt6 6.5 REQUIRED COMPONENTS Core Widgets sql)
find_package(Qt6 REQUIRED COMPONENTS LinguistTools)


set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_AUTOUIC ON)
qt_standard_project_setup()
#代码目录
aux_source_directory(${CMAKE_CURRENT_SOURCE_DIR}/view/ VIEW_FILE)
aux_source_directory(${CMAKE_CURRENT_SOURCE_DIR}/ui/ UI_FILE)
aux_source_directory(${CMAKE_CURRENT_SOURCE_DIR}/source/ SOURCE_FILE)
file(GLOB HEADER_FILE "${CMAKE_CURRENT_SOURCE_DIR}/headers/*.h")

qt_add_translations(surgicalrobot TS_FILES surgicalrobot_zh_CN.ts)

qt_add_executable(surgicalrobot
    WIN32 MACOSX_BUNDLE
    ${VIEW_FILE}
    ${UI_FILE}
    ${HEADER_FILE}
    ${SOURCE_FILE}
)

target_link_libraries(surgicalrobot
    PRIVATE
        Qt::Core
        Qt::Widgets
        Qt6::Sql
)

include(GNUInstallDirs)

install(TARGETS surgicalrobot
    BUNDLE  DESTINATION .
    RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
    LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
)

qt_generate_deploy_app_script(
    TARGET surgicalrobot
    OUTPUT_SCRIPT deploy_script
    NO_UNSUPPORTED_PLATFORM_ERROR
)
install(SCRIPT ${deploy_script})
